package com.lsh.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * @author ：LiuShihao
 * @date ：Created in 2020/7/8 9:49 上午
 * @desc ：动态数据源的实现
 */

@Slf4j
public class DynamicDataSource extends AbstractRoutingDataSource{

    @Override
    protected Object determineCurrentLookupKey() {
        return DatabaseContextHolder.getDataBaseType();
    }

    public DynamicDataSource(){
        log.info("加载DynamicDataSource");
    }


}